define(function (require, exports, module) {

    Vue.use(VueRouter)

    var one = require('./src/com_test/show-times/index.js');
    var two = require('./src/com_test/show-times02/index.js');
    var three = require('./src/com_test/show-times03/index.js');

    //创建一个路由器实例
    var router = new VueRouter({
        // mode: 'history',
        routes: [{
            path: '/one',
            name: 'one',
            component: one,
            meta: {
                keepAlive: true  //默认要缓存
            }
        }, {
            path: '/two',
            name: 'two',
            component: two,
            meta: {
                keepAlive: true  //默认要缓存
            }
        }, {
            path: '/three',
            name: 'three',
            component: three,
            meta: {
                keepAlive: true  //默认要缓存
            }
        }]
    });

    //实现前进刷新,后退不刷新
    let routerList = []
    router.beforeEach((to, from, next) => {

        //alert(routerList.indexOf(to.name) + "" + routerList.length - 1);

        //是否是最后一个
        if (routerList.length && routerList.indexOf(to.name) === routerList.length - 1) {
            // 后退
            routerList.splice(routerList.length - 1, 1)
            //to.meta.isBack = true
            to.meta.keepAlive = true
        } else {
            // 前进
            routerList.push(from.name || '/')
            //to.meta.isBack = false
            to.meta.keepAlive = false
        }
        next()
    })

    var app = new Vue({
        router: router

    }).$mount('#app')


});